#ifndef CGSHADERINTERFACE_H_
#define CGSHADERINTERFACE_H_

#include "precom.h"
#include <vector>
#include <boost/function.hpp>
#include <boost/bind.hpp>

const unsigned int MAX_LIGHT_NUMBER = 8;

class CgShaderInterface;

enum CgShaderExternalVecData {
	CgEnum_EyePos = 0, 
	CgEnum_ToolPos = 1,
	CgEnum_ToolAxis = 2,
	ShaderExternalVecDataNum = 3
};

enum CgShaderExternalFloatData {
	CgEnum_Speccular_ForVert = 0,
	CgEnum_Diffusion_ForVert = 1,
	CgEnum_Emitiffe_ForVert = 2,
	ShaderExternalFloatDataNum = 3
};

class CgShaderInterface
{
private:
protected:
	unsigned int m_lightNum;
	CGprogram cg_vertProg, cg_fragProg;
	CGparameter cg_lightPos[MAX_LIGHT_NUMBER];
	CGparameter cg_modelViewProjMatrix, cg_modelViewMatrix;
	
public:
	CgShaderInterface();
	virtual ~CgShaderInterface();

	virtual bool CgShaderInit(HWND a_hWnd, CGcontext a_cg_context,
		CGprofile a_cg_vertProfile, CGprofile a_cg_fragProfile) 
	{ return true; }
	virtual void SetLights(const fmath::vector3* a_lightsTab, size_t a_lightsNum);
	virtual void SetEyePosition(const fmath::vector3& a_eye) {}
	virtual void SetWorldViewProjMatrix();
	
	virtual std::vector<boost::function<void(const fmath::vector3&)>> SignUpForVecInfo();
	virtual std::vector<boost::function<void(float)>> SignUpForFloatInfo();

	inline CGprogram GetCgVertProgram()
	{
		return cg_vertProg;
	}

	inline CGprogram GetCgFragProgram()
	{
		return cg_fragProg;
	}
};

#endif //CGSHADERINTERFACE_H_